/*
 *  Copyright (C) 2011 JiangHongTiao <jjurco.sk_gmail.com>
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package sk.lieskove301.jianghongtiao.liaad.prisoner.strategy;

import sk.lieskove301.jianghongtiao.liaad.prisoner.agent.Agent;
import java.util.List;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.crossover.Crossover;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.mutation.Mutation;
import sk.lieskove301.jianghongtiao.liaad.prisoner.ga.selection.Selection;
import sk.lieskove301.jianghongtiao.liaad.prisoner.gene.GeneEnum;
import sk.lieskove301.jianghongtiao.liaad.prisoner.payoff.PayoffValue;
import sk.lieskove301.jianghongtiao.liaad.prisoner.memory.Forgetting;
import sk.lieskove301.jianghongtiao.liaad.prisoner.memory.ForgettingEnum;

/**
 * Date of create: May 15, 2011
 *
 * @author JiangHongTiao <jjurco.sk_gmail.com>
 * @version 2011.0515
 */
public interface Strategy {

    /**
     * method incubator is responsible for initial setting up arena with agents.
     * this method makes list of agents for play.
     * @param numberOfAgents number of agents to create
     * @return list with created agents
     */
    public List<Agent> incubator(int numberOfAgents);

    /**
     * during the play we kill some agents. This method is responsible for creating
     * agents to renew population of agents.
     * @param numberOfMissingAgents number of killed agents or how many agents we need to create
     * @param population actual population with agents. Can use genetic material
     * of this agents for creating new agents
     * @return list of created agents by any strategy of creating
     */
    public List<Agent> renewPopulation(List<Agent> population, int year);

    /**
     * kill unsuccessful agents from the population by any strategy of removing them
     * @param population actual population of agents
     * @return list of dead agents
     */
    public List<Agent> genocide(List<Agent> population);

    /**
     * list of forgetting types used in strategy
     * @return agents forgetting
     */
    public ForgettingEnum[] getForgetting();

    /**
     * set list of possible forgetting of agent
     * @param forgetting forgetting of agents
     */
    public void setForgetting(ForgettingEnum[] forgetting);

    /**
     * get payoff matrix 
     * @return payoff matrix
     */
    public PayoffValue getPayoff();

    /**
     * set payoff matrix of agent's
     * @param payoff
     */
    public void setPayoff(PayoffValue payoff);

    /**
     * set strategy of amnesia for agent
     * @param agent apply amnesia to this agent
     */
    public void agentsAmnesia(Agent agent);
    
    /**
     * crossover type used for generating new agents
     * @return crossover used in strategy
     */
    public Crossover getCrossover();

    /**
     * set crossover strategy which will be used in strategy
     * @param crossover crossover type
     */
    public void setCrossover(Crossover crossover);

    /**
     * get mutation strategy used in strategy
     * @return mutation type used in strategy
     */
    public Mutation getMutation();

    /**
     * set mutation strategy which will be used in strategy
     * @param mutation mutation used in strategy
     */
    public void setMutation(Mutation mutation);

    /**
     * get selection type used for selecting successful agents. From these selected
     * agents is generated new offspring
     * @return selection type used in strategy
     */
    public Selection getSelection();

    /**
     * set selection type which will be used for selecting successful agents. From 
     * these selected agents is generated new offspring
     * @param selection selection which will be used in strategy
     */
    public void setSelection(Selection selection);
    
    /**
     * genes used during strategy of generating new agents
     * @return array of possible genes used during strategy
     */
    public GeneEnum[] getPossibleGenes();

    /**
     * set possible genes which will be used in strategy for generating new offspring
     * @param possibleGenes possible genes of agents and their offspring
     */
    public void setPossibleGenes(GeneEnum[] possibleGenes);
}
